# celery的启动文件

from celery import Celery
# 为celery使用django配置文件进行设置
import os

if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'go_shopping.settings.dev'

# 创建celery应用
app = Celery('go_shopping')

# 导入celery配置
app.config_from_object('celery_tasks.config')

# 自动注册celery任务(tasks.py)
app.autodiscover_tasks(['celery_tasks.sms','celery_tasks.email','celery_tasks.html'])

# 启动celery指令
# celery -A  celery_tasks.main worker -l info
